package update.links.com.versionupdate;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.widget.TextView;

import com.prim.update.UpdateManager;
import com.prim.update.model.Progress;
import com.prim.update.state.UpdateState;

public class Main2Activity extends AppCompatActivity {

    private TextView textView;

    private static final String TAG = "Main2Activity";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main2);
        textView = (TextView) findViewById(R.id.main2);
        textView.setText("任务状态:" + UpdateState.getState());
        UpdateManager.getInstance().setOnDownloadProgressListener(new UpdateManager.OnDownloadProgressListener() {
            @Override
            public void onStart() {
            }

            @Override
            public void onProgress(Progress progress) {
                textView.setText((int) (progress.fraction * 100) + "%");
            }

            @Override
            public void onError(String msg) {
            }

            @Override
            public void onFinish() {
            }
        });
    }
}
